/**
 * <copyright>
 * </copyright>
 *

 */
package br.ufrn.dimap.MetricDslLanguage.metricDsl.impl;

import br.ufrn.dimap.MetricDslLanguage.metricDsl.ActivityMetric;
import br.ufrn.dimap.MetricDslLanguage.metricDsl.ArtefactMetric;
import br.ufrn.dimap.MetricDslLanguage.metricDsl.ColectType;
import br.ufrn.dimap.MetricDslLanguage.metricDsl.MetricDslFactory;
import br.ufrn.dimap.MetricDslLanguage.metricDsl.MetricDslPackage;
import br.ufrn.dimap.MetricDslLanguage.metricDsl.MetricType;
import br.ufrn.dimap.MetricDslLanguage.metricDsl.MetricUnit;
import br.ufrn.dimap.MetricDslLanguage.metricDsl.Metrics;
import br.ufrn.dimap.MetricDslLanguage.metricDsl.Model;
import br.ufrn.dimap.MetricDslLanguage.metricDsl.TaskMetric;

import br.ufrn.dimap.processDsl.ProcessDslPackage;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class MetricDslPackageImpl extends EPackageImpl implements MetricDslPackage
{
  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass modelEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass metricsEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass activityMetricEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass taskMetricEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass artefactMetricEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EEnum metricTypeEEnum = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EEnum colectTypeEEnum = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EEnum metricUnitEEnum = null;

  /**
   * Creates an instance of the model <b>Package</b>, registered with
   * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
   * package URI value.
   * <p>Note: the correct way to create the package is via the static
   * factory method {@link #init init()}, which also performs
   * initialization of the package, or returns the registered package,
   * if one already exists.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see org.eclipse.emf.ecore.EPackage.Registry
   * @see br.ufrn.dimap.MetricDslLanguage.metricDsl.MetricDslPackage#eNS_URI
   * @see #init()
   * @generated
   */
  private MetricDslPackageImpl()
  {
    super(eNS_URI, MetricDslFactory.eINSTANCE);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private static boolean isInited = false;

  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
   * 
   * <p>This method is used to initialize {@link MetricDslPackage#eINSTANCE} when that field is accessed.
   * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static MetricDslPackage init()
  {
    if (isInited) return (MetricDslPackage)EPackage.Registry.INSTANCE.getEPackage(MetricDslPackage.eNS_URI);

    // Obtain or create and register package
    MetricDslPackageImpl theMetricDslPackage = (MetricDslPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof MetricDslPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new MetricDslPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    ProcessDslPackage.eINSTANCE.eClass();

    // Create package meta-data objects
    theMetricDslPackage.createPackageContents();

    // Initialize created meta-data
    theMetricDslPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theMetricDslPackage.freeze();

  
    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(MetricDslPackage.eNS_URI, theMetricDslPackage);
    return theMetricDslPackage;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getModel()
  {
    return modelEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getModel_Metrics()
  {
    return (EReference)modelEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getMetrics()
  {
    return metricsEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getMetrics_Name()
  {
    return (EAttribute)metricsEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getMetrics_RelatesTo()
  {
    return (EReference)metricsEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getMetrics_Description()
  {
    return (EAttribute)metricsEClass.getEStructuralFeatures().get(2);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getMetrics_Type()
  {
    return (EAttribute)metricsEClass.getEStructuralFeatures().get(3);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getMetrics_Form()
  {
    return (EAttribute)metricsEClass.getEStructuralFeatures().get(4);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getMetrics_Id()
  {
    return (EAttribute)metricsEClass.getEStructuralFeatures().get(5);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getMetrics_Unit()
  {
    return (EAttribute)metricsEClass.getEStructuralFeatures().get(6);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getMetrics_Details()
  {
    return (EReference)metricsEClass.getEStructuralFeatures().get(7);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getActivityMetric()
  {
    return activityMetricEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getActivityMetric_ActivityBegin()
  {
    return (EReference)activityMetricEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getActivityMetric_ActivityEnd()
  {
    return (EReference)activityMetricEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getTaskMetric()
  {
    return taskMetricEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getTaskMetric_Tasks()
  {
    return (EReference)taskMetricEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getArtefactMetric()
  {
    return artefactMetricEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getArtefactMetric_Name()
  {
    return (EAttribute)artefactMetricEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getArtefactMetric_Artefacts()
  {
    return (EReference)artefactMetricEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EEnum getMetricType()
  {
    return metricTypeEEnum;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EEnum getColectType()
  {
    return colectTypeEEnum;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EEnum getMetricUnit()
  {
    return metricUnitEEnum;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public MetricDslFactory getMetricDslFactory()
  {
    return (MetricDslFactory)getEFactoryInstance();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private boolean isCreated = false;

  /**
   * Creates the meta-model objects for the package.  This method is
   * guarded to have no affect on any invocation but its first.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void createPackageContents()
  {
    if (isCreated) return;
    isCreated = true;

    // Create classes and their features
    modelEClass = createEClass(MODEL);
    createEReference(modelEClass, MODEL__METRICS);

    metricsEClass = createEClass(METRICS);
    createEAttribute(metricsEClass, METRICS__NAME);
    createEReference(metricsEClass, METRICS__RELATES_TO);
    createEAttribute(metricsEClass, METRICS__DESCRIPTION);
    createEAttribute(metricsEClass, METRICS__TYPE);
    createEAttribute(metricsEClass, METRICS__FORM);
    createEAttribute(metricsEClass, METRICS__ID);
    createEAttribute(metricsEClass, METRICS__UNIT);
    createEReference(metricsEClass, METRICS__DETAILS);

    activityMetricEClass = createEClass(ACTIVITY_METRIC);
    createEReference(activityMetricEClass, ACTIVITY_METRIC__ACTIVITY_BEGIN);
    createEReference(activityMetricEClass, ACTIVITY_METRIC__ACTIVITY_END);

    taskMetricEClass = createEClass(TASK_METRIC);
    createEReference(taskMetricEClass, TASK_METRIC__TASKS);

    artefactMetricEClass = createEClass(ARTEFACT_METRIC);
    createEAttribute(artefactMetricEClass, ARTEFACT_METRIC__NAME);
    createEReference(artefactMetricEClass, ARTEFACT_METRIC__ARTEFACTS);

    // Create enums
    metricTypeEEnum = createEEnum(METRIC_TYPE);
    colectTypeEEnum = createEEnum(COLECT_TYPE);
    metricUnitEEnum = createEEnum(METRIC_UNIT);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private boolean isInitialized = false;

  /**
   * Complete the initialization of the package and its meta-model.  This
   * method is guarded to have no affect on any invocation but its first.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void initializePackageContents()
  {
    if (isInitialized) return;
    isInitialized = true;

    // Initialize package
    setName(eNAME);
    setNsPrefix(eNS_PREFIX);
    setNsURI(eNS_URI);

    // Obtain other dependent packages
    ProcessDslPackage theProcessDslPackage = (ProcessDslPackage)EPackage.Registry.INSTANCE.getEPackage(ProcessDslPackage.eNS_URI);

    // Create type parameters

    // Set bounds for type parameters

    // Add supertypes to classes

    // Initialize classes and features; add operations and parameters
    initEClass(modelEClass, Model.class, "Model", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getModel_Metrics(), this.getMetrics(), null, "metrics", null, 0, -1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(metricsEClass, Metrics.class, "Metrics", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getMetrics_Name(), ecorePackage.getEString(), "name", null, 0, 1, Metrics.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getMetrics_RelatesTo(), theProcessDslPackage.getProcess(), null, "relatesTo", null, 0, 1, Metrics.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getMetrics_Description(), ecorePackage.getEString(), "description", null, 0, 1, Metrics.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getMetrics_Type(), this.getMetricType(), "type", null, 0, 1, Metrics.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getMetrics_Form(), this.getColectType(), "form", null, 0, 1, Metrics.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getMetrics_Id(), ecorePackage.getEString(), "id", null, 0, 1, Metrics.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getMetrics_Unit(), this.getMetricUnit(), "unit", null, 0, 1, Metrics.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getMetrics_Details(), ecorePackage.getEObject(), null, "details", null, 0, 1, Metrics.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(activityMetricEClass, ActivityMetric.class, "ActivityMetric", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getActivityMetric_ActivityBegin(), theProcessDslPackage.getActivity(), null, "activityBegin", null, 0, 1, ActivityMetric.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getActivityMetric_ActivityEnd(), theProcessDslPackage.getActivity(), null, "activityEnd", null, 0, 1, ActivityMetric.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(taskMetricEClass, TaskMetric.class, "TaskMetric", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getTaskMetric_Tasks(), theProcessDslPackage.getTask(), null, "tasks", null, 0, -1, TaskMetric.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(artefactMetricEClass, ArtefactMetric.class, "ArtefactMetric", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getArtefactMetric_Name(), ecorePackage.getEString(), "name", null, 0, 1, ArtefactMetric.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getArtefactMetric_Artefacts(), theProcessDslPackage.getArtifact(), null, "artefacts", null, 0, -1, ArtefactMetric.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    // Initialize enums and add enum literals
    initEEnum(metricTypeEEnum, MetricType.class, "MetricType");
    addEEnumLiteral(metricTypeEEnum, MetricType.HARD_DATA);
    addEEnumLiteral(metricTypeEEnum, MetricType.SOFT_DATA);
    addEEnumLiteral(metricTypeEEnum, MetricType.NORMALIZED_DATA);

    initEEnum(colectTypeEEnum, ColectType.class, "ColectType");
    addEEnumLiteral(colectTypeEEnum, ColectType.CONTINUOUS);
    addEEnumLiteral(colectTypeEEnum, ColectType.INTERCALATED);

    initEEnum(metricUnitEEnum, MetricUnit.class, "MetricUnit");
    addEEnumLiteral(metricUnitEEnum, MetricUnit.MINUTES);
    addEEnumLiteral(metricUnitEEnum, MetricUnit.UC);
    addEEnumLiteral(metricUnitEEnum, MetricUnit.NUMBERS);

    // Create resource
    createResource(eNS_URI);
  }

} //MetricDslPackageImpl
